home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / system / ifp1s158.zip / PAGE_06.PAS < prev    next >
Pascal/Delphi Source File  |  1993-06-26  |  40KB  |  1,221 lines

  1. unit page_06;
  2.  
  3. interface
  4.  
  5. uses crt, dos, graph, ifpglobl, ifpcomon, ifpextrn;
  6.  
  7. procedure page06;
  8.  
  9. implementation
  10.  
  11. procedure page06;
  12. const
  13.   atividmons: array[0..15] of string[24] =
  14.                ('EGA', 'analog monochrome', 'TTL monochrome', 'analog color',
  15.                 'RGB color', 'Multisync or compatible', '(unknown)',
  16.                 'PS/2 8514 or compatible', 'Seiko 1430', 'MultiSync 2A',
  17.                 'Tatung OmniScan', 'NEC 3D or compatible', 'TVM 3M',
  18.                 'NEC MultiSync XL/+/4D/5D', 'TVM 2A', 'TVM 3A');
  19.   trividmons: array[0..7] of string[17] =
  20.                ('MDA', 'CGA', 'EGA', 'Digital multisync', 'VGA', '8514',
  21.                 'SuperVGA', 'Analog multisync');
  22.   parachips: array[1..4] of string[7] =
  23.                ('PVGA1A', 'WD90C00', 'WD90C10', 'WD90C11');
  24.  
  25.  
  26. type
  27.   cardtype = (none, vesa, standard, paradise, video7, ati, ahead, cirrus,
  28.                cti, genoa, trident, tseng, zymos);
  29.   VESAitype = record
  30.                 signature: array[0..3] of char;
  31.                 version: word;
  32.                 OEMnameOfs: word;
  33.                 OEMnameSeg: word;
  34.                 capabilities: array[0..3] of byte;
  35.                 modesOfs: word;
  36.                 modesSeg: word;
  37.                 reserved: array[0..237] of byte;
  38.               end;
  39.   VESAmtype = record
  40.                 modeattr: word;
  41.                 winaattr: byte; {Window A attributes}
  42.                 winbattr: byte; {Window B attributes}
  43.                 wingran: word;  {Window Granularity}
  44.                 winsize: word;  {Window Size}
  45.                 winaseg: word;  {Window A segment}
  46.                 winbseg: word;  {Window B segment}
  47.                 posOfs: word;   {Offset of Far call to positioning function}
  48.                 posSeg: word;   {Segment ..}
  49.                 scansize: word; {Bytes per scan line}
  50.                 {The following information is optional for VESA modes,
  51.                  required for OEM modes}
  52.                 pixwidth: word;
  53.                 pixheight: word;
  54.                 charwidth: byte;
  55.                 charheight: byte;
  56.                 memplanes: byte;
  57.                 pixelbits: byte;
  58.                 banks: byte;
  59.                 memmodel: byte;
  60.                 banksize: byte;
  61.                 imagepages: byte;
  62.                 reserved0a: byte;
  63.                 {The following is part of VESA 1.2 and newer}
  64.                 RedMaskSize: byte;
  65.                 RedFieldPos: byte;
  66.                 GrnMaskSize: byte;
  67.                 GrnFieldPos: byte;
  68.                 BluMaskSize: byte;
  69.                 BluFieldPos: byte;
  70.                 RsrvdMaskSize: byte;
  71.                 RsrvdMaskPos: byte;
  72.                 DirectColorInfo: byte;
  73.                 Reserved0b: byte;
  74.                 reserved: array[0..215] of byte;
  75.               end;
  76.  
  77. ATIvidtype = record
  78.                columns: byte;
  79.                maxrow: byte;
  80.                lines_a_row: byte;
  81.                buffer_size: word;
  82.                seqreg: array[1..4] of byte;
  83.                miscreg: byte;
  84.                crtsreg: array[0..$18] of byte;
  85.                attrreg: array[0..$13] of byte;
  86.                graphreg: array[0..8] of byte;
  87.              end;
  88.  
  89. var
  90.   i : byte;
  91.   VGAbuf : array[$00..$10] of byte;
  92.   VESAinfo: VESAitype;
  93.   VESAmode: VESAmtype;
  94.   xbyte, xbyte2, xbyte3, paralock1, paralock2: byte;
  95.   xword1 : word;
  96.   xword2 : word;
  97.   xword3 : word;
  98.   xword4 : word;
  99.   vgacard: cardtype;
  100.   vidmem : word;
  101.   s: string;
  102.   c: char;
  103.   saveattr, savex, savey: byte;
  104.   foundone, foundit: boolean;
  105.  
  106. procedure captfont;
  107.   begin
  108.   caption1('Font           Address');
  109.   Writeln;
  110.   Write('INT 1FH        ');
  111.   segofs(longint(intvec[$1F]) shr 16, longint(intvec[$1F]) and $0000FFFF);
  112.   Writeln
  113.   end; {captfont}
  114.  
  115. procedure showfont(a : byte);
  116.   const
  117.     fontnames: array [0..7] of string[12] = (
  118.                  'INT 1FH     ',
  119.                  'INT 43H     ',
  120.                  'ROM 8x14    ',
  121.                  'ROM 8x8 (lo)',
  122.                  'ROM 8x8 (hi)',
  123.                  'ROM 9x14    ',
  124.                  'ROM 8x16    ',
  125.                  'ROM 9x16    ');
  126.  
  127.   begin
  128.   with regs do
  129.     begin
  130.     Write(fontnames[a], '   ');
  131.     AX:=$1130;
  132.     BH:=a;
  133.     intr($10, regs);
  134.     segofs(ES, BP);
  135.     Writeln
  136.     end
  137.   end; {showfont}
  138.  
  139. procedure int101210;
  140.   const
  141.     memnames: array[0..3] of string[4] = ('64K', '128K', '192K', '256K');
  142.  
  143.   begin
  144.   with regs do
  145.     begin
  146.     AH:=$12;
  147.     BL:=$10;
  148.     intr($10, regs);
  149.     caption2('Display type');
  150.     case BH of
  151.       $00 : Writeln('color');
  152.       $01 : Writeln('monochrome')
  153.       else
  154.         unknown('display', BH, 2)
  155.     end;
  156.     caption2('Memory');
  157.     if vidmem > 0 then
  158.       Writeln(vidmem, 'K')
  159.     else
  160.       if BL < 4 then
  161.         Writeln(memnames[BL], ' as determined from standard BIOS call')
  162.       else
  163.         unknown('size', BL, 2);
  164.     if vgacard = none then
  165.       begin
  166.       caption2('Feature bits');
  167.       Writeln(bin4(CH and $0F));
  168.       caption2('DIP switches (EGA)');
  169.       Writeln(bin4(CL and $0F))
  170.       end
  171.     end
  172.   end;
  173.  
  174.   function readROM(seg, ofs: word; length: byte): string;
  175.     var
  176.       x: word;
  177.       s: string;
  178.  
  179.     begin
  180.     s:='';
  181.     for x:=ofs to ofs + (length - 1) do
  182.       s:=s + Chr(Mem[seg:x]);
  183.     readROM:=s
  184.     end; {readROM}
  185.  
  186.   procedure checking(s: string);
  187.     var
  188.       x, y: byte;
  189.     begin
  190.     x:=WhereX;
  191.     y:=WhereY;
  192.     ClrEol;
  193.     Write('Checking for ', s);
  194.     GotoXY(x, y);
  195.     end; {checking}
  196.  
  197.   procedure d8or16bit(b: boolean);
  198.     begin
  199.     if b then
  200.       Write('8-bit')
  201.     else
  202.       Write('16-bit');
  203.     end;
  204.  
  205.   procedure cli;
  206.     inline($FA);
  207.  
  208.   procedure sti;
  209.     inline($FB);
  210.  
  211.   function isXGA: word;
  212.     var
  213.       POSport, cardID, tmpw: word;
  214.       tmp, tmp1, tmp2, tmp3, tmp4: byte;
  215.       slot: byte;
  216.       regs: registers;
  217.       foundit: boolean;
  218.  
  219.     begin
  220.     isXGA:=0;
  221.     foundit:=false;
  222.     with regs do
  223.       begin
  224.       DX:=$FFFF;
  225.       AX:=$C400;
  226.       Intr($15, regs);
  227.       if (not nocarry(regs)) or (DX = -1) then
  228.         Exit;
  229.       posport:=DX;
  230.       slot:=0;
  231.       repeat
  232.         cli;
  233.         if slot = 0 then
  234.           Port[$94]:=$DF
  235.         else
  236.           begin
  237.           AX:=$C401;
  238.           BX:=slot;
  239.           Intr($15, regs)
  240.           end;
  241.         cardID:=PortW[POSport];
  242.         tmp1:=Port[POSport + 2];
  243.         tmp2:=Port[POSport + 3];
  244.         tmp3:=Port[POSport + 4];
  245.         tmp4:=Port[POSport + 5];
  246.         if slot = 0 then
  247.           Port[$94]:=$FF
  248.         else
  249.           begin
  250.           AX:=$C402;
  251.           BX:=slot;
  252.           Intr($15, regs);
  253.           end;
  254.         cli;
  255.         if (cardID >= $8FD8) and (cardID <= $8FDB) then
  256.           begin
  257.           tmpw:=tmp1 and $E;
  258.           POSport:=(tmpw shl 3) + $2100;
  259.           Port[POSport + $A]:=$52;
  260.           tmp:=Port[POSport + $B] and $F;
  261.           if (tmp <> 0) and (tmp <> $F) then
  262.             foundit:=true
  263.           else
  264.             Inc(slot);
  265.           end
  266.         else
  267.           Inc(slot);
  268.       until foundit or (slot > 9);
  269.       end;
  270.     if foundit then
  271.       isXGA:=POSport;
  272.     end; {isXGA}
  273.  
  274.   procedure isport2(var regs: registers; var foundit: boolean);
  275.     var
  276.       savebx, saveax: word;
  277.       tmp: byte;
  278.  
  279.     begin
  280.     with regs do
  281.       begin
  282.       savebx:=BX;
  283.       BX:=AX;
  284.       Port[DX]:=AL;
  285.       AH:=AL;
  286.       AL:=Port[DX + 1];
  287.       tmp:=AH;
  288.       AH:=AL;
  289.       AL:=tmp;
  290.       saveax:=AX;
  291.       AX:=BX;
  292.       PortW[DX]:=AX;
  293.       Port[DX]:=AL;
  294.       AH:=AL;
  295.       AL:=Port[DX + 1];
  296.       AL:=AL and BH;
  297.       foundit:=(AL = BH);
  298.       if AL = BH then
  299.         begin
  300.         AL:=AH;
  301.         AH:=0;
  302.         Port[DX]:=AX;
  303.         Port[DX]:=AL;
  304.         AH:=AL;
  305.         AL:=Port[DX + 1];
  306.         AL:=AL and BH;
  307.         foundit:=(AL = 0);
  308.         end;
  309.       AX:=saveax;
  310.       PortW[DX]:=AX;
  311.       BX:=savebx;
  312.       end;
  313.     end;
  314.  
  315.   begin (* procedure page_06 *)
  316.   vgacard:=none;
  317.   caption2('Display adapter');
  318.   checking('VESA');
  319.   with regs do
  320.     begin
  321.